﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure.Utility.Core.CommonUtility
{
    public static class NumberUtility
    {
        public static bool HasValue(this long? number)
        {
            return number.HasValue;
        }

        public static bool HasValueNotZero(this long? number)
        {
            return number.HasValue && number != 0;
        }


        public static bool HasValueNotZero(this long number)
        {
            return number != 0;
        }

        public static bool HasValue(this List<long> number)
        {
            return number != null && number.Any();
        }

        public static bool HasValue(this List<long?> strList)
        {
            return strList != null && strList.Any() && strList.Where(e => e.HasValue()).Any();
        }

        public static bool HasValueNotZero(this short? number)
        {
            return number.HasValue && number != 0;
        }


        public static bool HasValueEquel1(this short? number)
        {
            return number.HasValue && number == 1;
        }

        public static bool HasValueEquel0(this short? number)
        {
            return number.HasValue && number == 0;
        }
    }
}
